There are a lot of input and output functions in Linux and UNIX, and sometimes it really makes the rookie who wants to have a little bit of a relationship at their wits ' end. First to see what functions, through the analysis and summary, to see if
This article introduces how to use and pay attention to linux File I/O. If you need it, please refer to it.
In Linux, most file I/O only uses five functions: open, read, write, lseek, and close. The functions involved in this topic are called I/O
To discuss the issue of writing to the same file by multiple processes in a concurrent environment, we will involve knowledge of file sharing. Before we begin, let's discuss some knowledge about file sharing.
1. File sharing
UNIX systems support the
Most file I/O in a Linux system uses only 5 functions: Open,read,write,lseek and close. The functions covered in this topic are called I/O with no buffering, and without buffering, read or read are implemented through a system call to the kernel,
Reproduced.
To discuss the issue of writing to the same file by multiple processes in a concurrent environment, we will involve knowledge of file sharing. Before we begin, let's discuss some knowledge about file sharing.
1. File Sharing
UNIX
A good introduction and use of Linux IO monitoring commands.1. System Level IO monitoring IostatIostat-xdm 1 # Personal habits%util indicates how busy the disk is. 100% indicates that the disk is busy and 0% indicates that the disk is idle. Note,
Given the portability and flexibility, LEVELDB abstracts the system-related processing (file/process/time) into EVN, and the user can implement the appropriate interface themselves, passing in as part of option, using its own implementation by
#include int open (const char *path, int oflag, .../* mode_t mode */); int Openat (int fd, const char *path, int Oflag, .../* mode_t mode * *);The Open function call successfully returns the file descriptor of the opened file, which returns 1 on
File IO and system programming
This article is the author read Tlpi (the Linux Programer interface Summary), in order to highlight the focus, avoid a cut, I will not too much to introduce the basic concepts and usage, I will focus on the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.